package tools

import (
	"fmt"
	"github.com/bwmarrin/snowflake"
	"github.com/gogf/gf/frame/g"
	"reflect"
)

func GetSnowflakeId() string {
	// default node id eq 1,this can modify to different serverId node
	node, _ := snowflake.NewNode(1)
	// Generate a snowflake ID.
	id := node.Generate().String()
	return id
}

// MessageLog 记录推送日志
func MessageLog(msg string)  {
	//_, _ = px_message_log.Model.Data(gdb.Map{"content":msg}).Insert()
}

// Dump 调试打印数据
func Dump(data interface{}, name ...string) {
	if data == nil {
		data = "null"
	}
	if len(name) == 0 {
		g.Dump(data)
	} else {
		typeOf := reflect.TypeOf(data)
		fmt.Println(name[0] + typeOf.String())
		g.Dump(data)
		fmt.Println(name[0])
	}
}